From 4a46d3b2b4c69dc736de963b88fb19524b8e584e Mon Sep 17 00:00:00 2001 From: robertl Date: Sat, 14 Jan 2006 03:48:29 +0000 Subject: [PATCH] Ensure waypoints are named uniquely before writing. --- mapsend.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/mapsend.c b/mapsend.c index f3515f983..ebea4cb18 100644 --- a/mapsend.c +++ b/mapsend.c @@ -1,7 +1,7 @@ /* Access Magellan Mapsend files. - Copyright (C) 2002 Robert Lipe, robertlipe@usa.net + Copyright (C) 2002-2006 Robert Lipe, robertlipe@usa.net This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -28,6 +28,7 @@ static FILE *mapsend_file_in; static FILE *mapsend_file_out; static short_handle mkshort_handle; +static short_handle wpt_handle; static int route_wp_count; static int mapsend_infile_version; @@ -94,6 +95,11 @@ mapsend_wr_init(const char *fname) { mapsend_file_out = xfopen(fname, "wb", MYNAME); mkshort_handle = mkshort_new_handle(); + + wpt_handle = mkshort_new_handle(); + setshort_whitespace_ok(wpt_handle, 1); + setshort_length(wpt_handle, 8); + route_wp_count = 0; } @@ -102,6 +108,7 @@ mapsend_wr_deinit(void) { fclose(mapsend_file_out); mkshort_del_handle(&mkshort_handle); + mkshort_del_handle(&wpt_handle); } static void @@ -335,7 +342,8 @@ mapsend_waypt_pr(const waypoint *waypointp) * them into the Mapsend file. */ - tmp = xstrdup(sn); + + tmp = mkshort(wpt_handle, sn); c = tmp ? strlen(tmp) : 0; fwrite(&c, 1, 1, mapsend_file_out); fwrite(tmp, c, 1, mapsend_file_out); -- 2.30.2